package com.ruoyi.business.service.impl.quickrepay;

import com.ruoyi.bizsys.domain.LoanIou;
import com.ruoyi.bizsys.domain.ReduceConfig;
import com.ruoyi.business.Vo.CustReduceRes;
import com.ruoyi.business.service.CustReduceProess;
import com.ruoyi.common.utils.DateUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

/**
 * @author wqg
 * @description 结束时间判断
 * @date 2022/4/7
 */
@Slf4j
@Order(1)
@Component
public class ReduceEndTimeImpl implements CustReduceProess {
    @Override
    public CustReduceRes handle(ReduceConfig reduceConfig, LoanIou loanIou, CustReduceRes custReduceRes) {
        if(DateUtils.compareTimes(
                DateUtils.dateTimeNow("yyyy-MM-dd HH:mm")
                ,DateUtils.dateTime(reduceConfig.getDayLastAt(),"yyyy-MM-dd HH:mm")
                ,"yyyy-MM-dd HH:mm")>0 ){
            log.info("CustReduceProess:小于截止时间"+reduceConfig.getDayLastAt().toString());
            custReduceRes.setIsHave(false);
            return custReduceRes;
        }
        return custReduceRes;
    }
}
